package com.seu.me.test;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by liangfeihu on 2018/5/19.
 */
@Slf4j
public class MyTest5 {

    public static void main(String[] args) {
        List<String> stringArrayList = new ArrayList<String>();
        List<Integer> integerArrayList = new ArrayList<Integer>();

        Class classStringArrayList = stringArrayList.getClass();
        Class classIntegerArrayList = integerArrayList.getClass();

        if (classStringArrayList.equals(classIntegerArrayList)) {
            log.info("泛型测试, 类型相同 {} {}", classStringArrayList.getName(), classIntegerArrayList.getName());
        }

        printMsg("111", 222, "aaaa", "2323.4", 55.55);

        List<?>[] lsa = new List<?>[10];
        Object o = lsa;
        Object[] oa = (Object[]) o;
        List<Integer> li = new ArrayList<Integer>();
        li.add(new Integer(3));
        oa[1] = li;
        Integer integer = (Integer) lsa[1].get(0);
        log.info("integer={}", integer);
    }

    public static <T> void printMsg(T... args) {
        for (T t : args) {
            log.info("泛型测试 t is {}", t);
        }
    }
}
